<?
session_start();
include 'php/functions.php';

$output = "<html>
				<head>
					<!-- User Window -->
				</head>
				<body>";	

$val = validate();
if ($val == 1){
	
	if($_SESSION['picture'] != ""){
		$output .= "<div class='border-pic'><div id='preview_pic_container'><img id='preview_pic' src='".$_SESSION['picture']."?".time()."' class='marg-auto'/></div><div>
				<script> isLoggedIn(); </script>";
	}else{
		$output .= "<div class='border-pic'><div id='preview_pic_container'><img id='preview_pic' src='media/unknown_n.png' class='marg-auto'/></div><div>
				<script> isLoggedIn(); </script>";
	}
			

}else{
	$output .= "<form class='marg-t-10' method='POST' action='javascript:loginUser();'>
					<table>
						<tr>
							<td colspan='2'><div class='normal-text bold-text pad-lr-3'>Email:</div></td>
						</tr>
						<tr>
							<td colspan='2'><input id='email_login' type='text' size='25' /></td>
						</tr>
						<tr>
							<td colspan='2'><div class='normal-text bold-text pad-lr-3'>Password:</div></td>
						</tr>
						<tr>
							<td colspan='2'><input id='password_login' type='password' size='25' /></td>
						</tr>
						<tr>
							<td class='vertical-middle'><div id='status_message_login' class='normal-text bold-text pad-5 error-container'></div></td>
							<td><div id='login-submit-button' class='fl-right'><input id='login-button' type='submit' value='Login' /></td>
						</tr>
					</table>
				</form>";
}
$output .= 		"</body>
			</html>";

echo $output;

?>
